package com.eascs.ticket.configuration.controller;

import javax.inject.Inject;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.eascs.site.page.PaginationInfo;
import com.eascs.site.page.SelectDataOption;
import com.eascs.site.view.ViewContext;
import com.eascs.site.view.button.Button;
import com.eascs.site.view.button.ButtonHelper;
import com.eascs.ticket.common.controller.BaseMasterViewController;
import com.eascs.ticket.configuration.form.TicketStatusViewForm;
import com.eascs.ticket.configuration.service.TicketStatusService;

@Controller
public class TicketStatusViewController extends BaseMasterViewController {

	@Inject
	private TicketStatusService ticketStatusService;

	@RequestMapping("/configuration/status/list")
	public String list() {
		PaginationInfo statusPaginationInfo = new PaginationInfo(this.ticketStatusService.getAllStatus(), new String[] { "名称", "类型", "排序号", "备注" });
		statusPaginationInfo.setSelectDataOptions(new SelectDataOption[] { null, new SelectDataOption("ticket_status_type") });
		statusPaginationInfo.setMoreButtons(new Button[] { ButtonHelper.createAjaxButton("修改", "/configuration/status/getTicketStatusView?id=") });
		ViewContext.put("statusPaginationInfo", statusPaginationInfo);
		return "configuration/status/list";
	}

	@RequestMapping("/configuration/status/view")
	public String view(TicketStatusViewForm ticketStatusViewForm) {
		ticketStatusViewForm.getId();
		PaginationInfo statusPaginationInfo = new PaginationInfo(this.ticketStatusService.getAllStatus(), new String[] { "名称", "类型", "备注" });
		statusPaginationInfo.setSelectDataOptions(new SelectDataOption[] { null, new SelectDataOption("ticket_status_type") });
		ViewContext.put("statusPaginationInfo", statusPaginationInfo);
		return "configuration/status/view";
	}

}
